package rms;

import be.VisitaProgramada;
import util.RecordManager;

/**
 *
 * @author Dikas
 */
public class ContrasteRMS {
    
    private final static String RS = "CONTRASTES";
    private RecordManager rm;

    public ContrasteRMS() {
        rm = new RecordManager(RS);
    }   
    
    public void addVisita(VisitaProgramada visitaProgramada){
        String json = visitaProgramada.toJson();        
        rm.addRecord(json);
    }
    
    public void setVisita(VisitaProgramada visitaProgramada, int index){
        String json = visitaProgramada.toJson();        
        rm.setRecord(index, json);
    }
    
    public VisitaProgramada getVisita(int index){
        VisitaProgramada visitaProgramada = new VisitaProgramada();        
        visitaProgramada.toObject(rm.getRecord(index));        
        return visitaProgramada;
    }
  
    public void clear(){
        rm.deleteRS();                
    }
    
    public int size(){
        return rm.numRecords();
    }
    
}
